package eaa.tgi.scrum.services;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import eaa.tgi.scrum.exceptions.FileLoadingException;

public class SerializationService {

	public byte[] fileToByteArray(File file) throws FileLoadingException {
		
		byte[] b = new byte[(int) file.length()];
		
		try {
		
			FileInputStream fileInputStream = new FileInputStream(file);
			fileInputStream.read(b);
			
		} catch (IOException exp) {
			
			throw new FileLoadingException("Erro durante envio de arquivo");
		}

		return b;
	}
}
